import 'dart:ui';

import 'package:extended_tabs/extended_tabs.dart';
import 'package:flutter/material.dart';
import 'package:live_music/components/ui/theme.dart';
import 'package:live_music/pages/friendList/page_view/friend_list.dart';
import 'package:live_music/pages/publish/widget/friend_list.dart';

class FriendListSelectPublishIndexPage extends StatefulWidget {
  const FriendListSelectPublishIndexPage({Key key}) : super(key: key);

  @override
  State<FriendListSelectPublishIndexPage> createState() =>
      _FriendListSelectPublishIndexPageState();
}

class _FriendListSelectPublishIndexPageState
    extends State<FriendListSelectPublishIndexPage>
    with SingleTickerProviderStateMixin {
  TabController _tabController;
  final List<Widget> _tabsContent = [
    FriendListPublish(type: 1),
    FriendListPublish(type: 2)
  ];
  final List<Widget> _tabs = [Text('好友'), Text('粉丝')];
  @override
  void initState() {
    super.initState();
    _tabController = TabController(
      initialIndex: 1,
      length: _tabs.length,
      vsync: this,
    );
  }

  @override
  Widget build(BuildContext context) {
    double screenWidth = MediaQuery.of(context).size.width;
    return Container(
        margin:
            EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top),
        child: Scaffold(
            appBar: AppBar(
              centerTitle: true,
              title: Container(
                  width: 0.35 * screenWidth,
                  child: ExtendedTabBar(
                    indicatorSize: TabBarIndicatorSize.label,
                    controller: _tabController,
                    indicatorColor: Colors.red,
                    indicatorWeight: 2,
                    unselectedLabelStyle: TextStyle(
                        color: Colors.grey[600], // 下划线颜色
                        fontSize: 14,
                        fontWeight: FontWeight.w600),
                    labelStyle: TextStyle(
                        color: Colors.white,
                        fontSize: 14,
                        fontWeight: FontWeight.w700), //标签文字大小颜色
                    tabs: _tabs,
                  )),
            ),
            body: Container(
              color: Colors.white,
              child: ExtendedTabBarView(
                controller: _tabController,
                children: _tabsContent,
              ),
            )));
  }
}
